
 <!DOCTYPE HTML>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
  
    <title>Airtest自动化测试初探 | Zong&#39;s blog</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=3, minimum-scale=1">
    
    <meta name="author" content="Zong">
    
    <meta name="description" content="Airtest是网易游戏内部工具团队开放出来的一个自动化测试工具，AirtestIDE 是一个跨平台的UI自动化测试编辑器，适用于游戏和App。

自动化脚本录制、一键回放、报告查看，轻而易举实现自动化测试流程
支持基于图像识别的Airtest框架，适用于所有Android和Windows游戏
支持">
    
    
    
    
    
    <link rel="icon" href="/img/favicon.ico">
    
    
    <link rel="apple-touch-icon" href="/img/pacman.jpg">
    <link rel="apple-touch-icon-precomposed" href="/img/pacman.jpg">
    
    <link rel="stylesheet" href="/css/style.css">
</head>
</html>
  <body>
    <header>
      <div>
		
			<div id="imglogo">
				<a href="/"><img src="/img/logo.svg" alt="Zong&#39;s blog" title="Zong&#39;s blog"/></a>
			</div>
			
			<div id="textlogo">
				<h1 class="site-name"><a href="/" title="Zong&#39;s blog">Zong&#39;s blog</a></h1>
				<h2 class="blog-motto">日常积累，技术分享</h2>
			</div>
			<div class="navbar"><a class="navbutton navmobile" href="#" title="Menu">
			</a></div>
			<nav class="animated">
				<ul>
					<ul>
					 
						<li><a href="/">Home</a></li>
					
						<li><a href="/archives">Archives</a></li>
					
						<li><a href="/categories/运维">运维</a></li>
					
						<li><a href="/categories/容器架构">容器架构</a></li>
					
					<li>
					
					<form class="search" action="//baidu.com/s" method="get" accept-charset="utf-8">
						<label>Search</label>
						<input type="text" id="search" name="wd" autocomplete="off" maxlength="20" placeholder="Search" />
                        <input name=tn type=hidden value="bds">
                        <input name=cl type=hidden value="3">
                        <input name=ct type=hidden value="2097152">
						<input type="hidden" name="si" value="www.lstop.pub">
					</form>
					
					</li>
				</ul>
			</nav>			
</div>

    </header>
    <div id="container">
      <div id="main" class="post" itemscope itemprop="blogPost">
	<article itemprop="articleBody"> 
		<header class="article-info clearfix">
  <h1 itemprop="name">
    
      <a href="/2019/06/27/Airtest自动化测试初探/" title="Airtest自动化测试初探" itemprop="url">Airtest自动化测试初探</a>
  </h1>
  <p class="article-author">By
    
      <a href="http://www.lstop.pub" title="Zong">Zong</a>
    </p>
  <p class="article-time">
    <time datetime="2019-06-27T08:27:27.000Z" itemprop="datePublished">2019-06-27</time>
    
  </p>
</header>

	<div class="article-content">
		
		
		<div id="toc" class="toc-article">
			<strong class="toc-title">Contents</strong>
		<ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#安装和配置手机"><span class="toc-number">1.</span> <span class="toc-text">安装和配置手机</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#界面"><span class="toc-number">2.</span> <span class="toc-text">界面</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#touch"><span class="toc-number">2.1.</span> <span class="toc-text">touch</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#swipe"><span class="toc-number">2.2.</span> <span class="toc-text">swipe</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#实际测试"><span class="toc-number">3.</span> <span class="toc-text">实际测试</span></a></li></ol>
		</div>
		
		<p>Airtest是网易游戏内部工具团队开放出来的一个自动化测试工具，AirtestIDE 是一个跨平台的UI自动化测试编辑器，适用于游戏和App。</p>
<ul>
<li>自动化脚本录制、一键回放、报告查看，轻而易举实现自动化测试流程</li>
<li>支持基于图像识别的Airtest框架，适用于所有Android和Windows游戏</li>
<li>支持基于UI控件搜索的Poco框架，适用于Unity3d，Cocos2d与Android App</li>
<li>访问官网通过视频查看更多特性</li>
</ul>
<p>这里是<a href="https://airtest.netease.com/docs/docs_AirtestIDE-zh_CN/index.html" target="_blank" rel="noopener">官方doc</a><br>最近接触了一下测试工作，所以对自动化测试这个领域有点好奇，就上网找了一下，发现这个貌似不错，接下来试用一下。</p>
<h1 id="安装和配置手机"><a href="#安装和配置手机" class="headerlink" title="安装和配置手机"></a>安装和配置手机</h1><p>软件是绿色版，解压就能用，这个点赞<br>配置手机比较复杂一点，大致分几步：</p>
<ol>
<li>安卓需要打开USB调试，这个各个品牌不一样，自己上网搜一下。</li>
<li>电脑上安卓手机驱动和adb</li>
<li>手机用USB线连电脑并确认授权</li>
<li>Airtest会在手机上安装一些软件，poco和输入法</li>
</ol>
<p>详细步骤看<a href="https://airtest.netease.com/docs/docs_AirtestIDE-zh_CN/2_device_connection/1_android_phone_connection.html" target="_blank" rel="noopener">这里</a></p>
<h1 id="界面"><a href="#界面" class="headerlink" title="界面"></a>界面</h1><p>左侧这里是Airtest辅助窗，上面是动作按钮，基本上就靠这些动作组合完成自动化测试，比如点击、拖拉、对比等。<br><img src="http://qnimg.banxiaoer.net/yw/airtest/airtest%E8%BE%85%E5%8A%A9%E7%AA%97.jpg_blog640.jpg" alt="airtest辅助窗"></p>
<h2 id="touch"><a href="#touch" class="headerlink" title="touch"></a>touch</h2><p>点击动作，平常的点按钮，点APP<br>方法参数可以是个图片，代码长这样：<br><img src="http://qnimg.banxiaoer.net/yw/airtest/touch.jpg_blog640.jpg" alt="touch"></p>
<h2 id="swipe"><a href="#swipe" class="headerlink" title="swipe"></a>swipe</h2><p>拖放操作，可以利用截图或者坐标轴定位</p>
<p>还有其他动作没细测。</p>
<h1 id="实际测试"><a href="#实际测试" class="headerlink" title="实际测试"></a>实际测试</h1><p>打开一个微信小程序，进行一定操作<br><img src="http://qnimg.banxiaoer.net/yw/airtest/bate1.gifairtest%E6%B5%8B%E8%AF%95.gif" alt="wx"></p>
<p>输入文本那里有点小问题，不过这个自动化测试体验还算顺利，脚本类似python形式，以后可以深入研究一下。</p>
<p>参考链接：<br><a href="https://testerhome.com/topics/14736" target="_blank" rel="noopener">使用 Airtest 进行微信小程序自动化测试 (Android &amp; iOS)</a><br><a href="https://testerhome.com/topics/12265" target="_blank" rel="noopener">网易游戏新开源的 UI 自动化测试项目 [Airtest Project]</a><br><a href="https://airtest.netease.com/docs/docs_AirtestIDE-zh_CN/index.html" target="_blank" rel="noopener">官方doc</a></p>
  
	</div>
		<footer class="article-footer clearfix">

  <div class="article-tags">
  
  <span></span> <a href="/tags/Airtest/">Airtest</a><a href="/tags/自动化测试/">自动化测试</a>
  </div>


<div class="article-categories">
  <span></span>
  <a class="article-category-link" href="/categories/测试/">测试</a>
</div>



<div class="article-share" id="share">

  <div data-url="http://www.lstop.pub/2019/06/27/Airtest自动化测试初探/" data-title="Airtest自动化测试初探 | Zong&#39;s blog" data-tsina="" class="share clearfix">
  </div>

</div>
</footer>   	       
	</article>
	
<nav class="article-nav clearfix">
 
 <div class="prev" >
 <a href="/2019/07/01/docker-registry清理历史镜像/" title="docker registry清理历史镜像">
  <strong>PREVIOUS:</strong><br/>
  <span>
  docker registry清理历史镜像</span>
</a>
</div>


<div class="next">
<a href="/2019/05/07/使用cAdvisor监控节点中的容器资源/"  title="使用cAdvisor监控节点中的容器资源">
 <strong>NEXT:</strong><br/> 
 <span>使用cAdvisor监控节点中的容器资源
</span>
</a>
</div>

</nav>

	
</div>  
      <div class="openaside"><a class="navbutton" href="#" title="Show Sidebar"></a></div>

  <div id="toc" class="toc-aside">
  <strong class="toc-title">Contents</strong>
  <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#安装和配置手机"><span class="toc-number">1.</span> <span class="toc-text">安装和配置手机</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#界面"><span class="toc-number">2.</span> <span class="toc-text">界面</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#touch"><span class="toc-number">2.1.</span> <span class="toc-text">touch</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#swipe"><span class="toc-number">2.2.</span> <span class="toc-text">swipe</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#实际测试"><span class="toc-number">3.</span> <span class="toc-text">实际测试</span></a></li></ol>
  </div>

<div id="asidepart">
<div class="closeaside"><a class="closebutton" href="#" title="Hide Sidebar"></a></div>
<aside class="clearfix">

  
<div class="tagslist">
	<p class="asidetitle">Tags</p>
		<ul class="clearfix">
		
			<li><a href="/tags/Airtest/" title="Airtest">Airtest<sup>1</sup></a></li>
		
			<li><a href="/tags/DNS/" title="DNS">DNS<sup>1</sup></a></li>
		
			<li><a href="/tags/GitLab/" title="GitLab">GitLab<sup>1</sup></a></li>
		
			<li><a href="/tags/K8s/" title="K8s">K8s<sup>8</sup></a></li>
		
			<li><a href="/tags/Linux/" title="Linux">Linux<sup>1</sup></a></li>
		
			<li><a href="/tags/MongoDB/" title="MongoDB">MongoDB<sup>2</sup></a></li>
		
			<li><a href="/tags/OpenWrt/" title="OpenWrt">OpenWrt<sup>1</sup></a></li>
		
			<li><a href="/tags/Python/" title="Python">Python<sup>2</sup></a></li>
		
			<li><a href="/tags/RabbitMQ/" title="RabbitMQ">RabbitMQ<sup>1</sup></a></li>
		
			<li><a href="/tags/calico/" title="calico">calico<sup>1</sup></a></li>
		
			<li><a href="/tags/cdn/" title="cdn">cdn<sup>1</sup></a></li>
		
			<li><a href="/tags/docker/" title="docker">docker<sup>3</sup></a></li>
		
			<li><a href="/tags/docker-registry/" title="docker registry">docker registry<sup>1</sup></a></li>
		
			<li><a href="/tags/elasticsearch/" title="elasticsearch">elasticsearch<sup>3</sup></a></li>
		
			<li><a href="/tags/elk/" title="elk">elk<sup>3</sup></a></li>
		
			<li><a href="/tags/k8s/" title="k8s">k8s<sup>3</sup></a></li>
		
			<li><a href="/tags/kubernetes/" title="kubernetes">kubernetes<sup>1</sup></a></li>
		
			<li><a href="/tags/nginx/" title="nginx">nginx<sup>1</sup></a></li>
		
			<li><a href="/tags/python/" title="python">python<sup>1</sup></a></li>
		
			<li><a href="/tags/tomcat/" title="tomcat">tomcat<sup>1</sup></a></li>
		
		</ul>
</div>


  <div class="linkslist">
  <p class="asidetitle">Links</p>
    <ul>
      <li><a href="http://www.v2ex.com/?r=zong400" target="_blank" title="V2EX">V2EX</a></li>
      <li><a href="http://hexo.io" target="_blank" title="Hexo">Hexo</a></li>
	  <li><a href="https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=s0bh6uzq" target="_blank" title="阿里云">阿里云</a></li>
	  <li><a href="https://cloud.tencent.com/redirect.php?redirect=1014&cps_key=5bd9deb84d4d9f34b65fb934e12d03e3&from=console" target="_blank" title="腾讯云">腾讯云</a></li>
    </ul>
</div>


</aside>
</div>
    </div>
    <footer><div id="footer" >
	
	
	<div class="social-font" class="clearfix">
		
		
		
		
	</div>
		<p class="copyright">Hosted by <a href="https://pages.coding.me/" target="_blank" title="Coding Pages">Coding Pages</a></p>
		<p class="copyright">Powered by <a href="http://hexo.io" target="_blank" title="hexo">hexo</a> and Theme by <a href="https://github.com/wizicer/iceman" target="_blank" title="Iceman">Iceman</a> © 2020 
		
		<a href="http://www.lstop.pub" target="_blank" title="Zong">Zong</a>
		
		</p>
</div>
</footer>
    <script src="//cdn.staticfile.org/jquery/2.1.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
  $('.navbar').click(function(){
    $('header nav').toggleClass('shownav');
  });
  var myWidth = 0;
  function getSize(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
  };
  var m = $('#main'),
      a = $('#asidepart'),
      c = $('.closeaside'),
      o = $('.openaside');
  $(window).resize(function(){
    getSize(); 
    if (myWidth >= 1024) {
      $('header nav').removeClass('shownav');
    }else
    {
      m.removeClass('moveMain');
      a.css('display', 'block').removeClass('fadeOut');
      o.css('display', 'none');
      
      $('#toc.toc-aside').css('display', 'none');
        
    }
  });
  c.click(function(){
    a.addClass('fadeOut').css('display', 'none');
    o.css('display', 'block').addClass('fadeIn');
    m.addClass('moveMain');
  });
  o.click(function(){
    o.css('display', 'none').removeClass('beforeFadeIn');
    a.css('display', 'block').removeClass('fadeOut').addClass('fadeIn');      
    m.removeClass('moveMain');
  });
  $(window).scroll(function(){
    o.css("top",Math.max(80,260-$(this).scrollTop()));
  });
});
</script>

<script type="text/javascript">
$(document).ready(function(){ 
  var ai = $('.article-content>iframe'),
      ae = $('.article-content>embed'),
      t  = $('#toc'),
      h  = $('article h2')
      ah = $('article h2'),
      ta = $('#toc.toc-aside'),
      o  = $('.openaside'),
      c  = $('.closeaside');
  if(ai.length>0){
    ai.wrap('<div class="video-container" />');
  };
  if(ae.length>0){
   ae.wrap('<div class="video-container" />');
  };
  if(ah.length==0){
    t.css('display','none');
  }else{
    c.click(function(){
      ta.css('display', 'block').addClass('fadeIn');
    });
    o.click(function(){
      ta.css('display', 'none');
    });
    $(window).scroll(function(){
      ta.css("top",Math.max(140,320-$(this).scrollTop()));
    });
  };
});
</script>


<script type="text/javascript">
$(document).ready(function(){ 
  var $this = $('.share'),
      url = $this.attr('data-url'),
      encodedUrl = encodeURIComponent(url),
      title = $this.attr('data-title'),
      tsina = $this.attr('data-tsina');
  var html = [
  '<a href="#" class="overlay" id="qrcode"></a>',
  '<div class="qrcode clearfix"><span>扫描二维码分享到微信朋友圈</span><a class="qrclose" href="#share"></a><strong>Loading...Please wait</strong><img id="qrcode-pic" data-src="http://s.jiathis.com/qrcode.php?url=' + encodedUrl + '"/></div>',
  '<a href="#textlogo" class="article-back-to-top" title="Top"></a>',
  '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
  '<a href="#qrcode" class="article-share-qrcode" title="QRcode"></a>',
  '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
  '<a href="http://service.weibo.com/share/share.php?title='+title+'&url='+encodedUrl +'&ralateUid='+ tsina +'&searchPic=true&style=number' +'" class="article-share-weibo" target="_blank" title="Weibo"></a>',
  '<span title="Share to"></span>'
  ].join('');
  $this.append(html);
  $('.article-share-qrcode').click(function(){
    var imgSrc = $('#qrcode-pic').attr('data-src');
    $('#qrcode-pic').attr('src', imgSrc);
    $('#qrcode-pic').load(function(){
        $('.qrcode strong').text(' ');
    });
  });
});     
</script>









  </body>
</html>

